package com.smart.buss.ctrl;

import java.util.UUID;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.smart.buss.service.BussAccountLogService;
import com.smart.buss.service.BussDakaLogService;
import com.smart.buss.service.BussDakaService;
import com.smart.buss.service.BussTaskLogService;
import com.smart.buss.service.BussTaskService;
import com.smart.buss.service.BussUserService;
import com.smart.primary.common.common.BaseCtrl;
import com.smart.primary.common.util.AjaxResult;
import com.smart.primary.common.util.StringUtil;
import com.smart.primary.sys.service.UserService;
import com.smart.primary.util.ContextHolderUtils;
import com.smart.primary.util.ServletUtil;

@RestController
@RequestMapping("/buss/user")
public class LoginFrontController extends BaseCtrl {
	private final static Logger logger= Logger.getLogger(LoginFrontController.class);

	@Autowired
	private BussUserService bussUserService;
	@Autowired
	private UserService sysUserService;
	@Autowired
	private BussDakaService bussDakaService;
	@Autowired
	private BussDakaLogService bussDakaLogService;
	@Autowired
	private BussAccountLogService bussAccountLogService;
	@Autowired
	private BussTaskService bussTaskService;
	@Autowired
	private BussTaskLogService bussTaskLogService;

	  
	 
	/**
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/check/login",produces="application/json")
	@ResponseBody
	public AjaxResult h5(HttpServletRequest request, HttpServletResponse response) {
		 
		JSONObject o = new JSONObject();
		String deviceToken = ContextHolderUtils.getDeviceToken(request);
		String channel = request.getParameter("channel");
		if(StringUtils.isEmpty(channel)) {
			channel = ServletUtil.getCookieValue(request, "channel");
		}
		String channelCode = ServletUtil.getCookieValue(request, "channel_code");
		try {
			 
			o.put("hasLogin", true);
		} catch (Exception e) {
			e.printStackTrace();

		}
		o.put(ContextHolderUtils.deviceToken, deviceToken);
		return AjaxResult.success(o);
		
	}

}
